package com.wn.inventory.web;

import com.wn.common.PageBean;
import com.wn.common.ResponseEntity;
import com.wn.entity.InspectionInWarehouseApplication;
import com.wn.inventory.service.InspectionInWarehouseApplicationService;
import com.wn.inventory.vo.InspectionInWarehouseApplicationVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @ author     ：NST
 * @ date       ：Created in 2022/10/21 14:26
 * @ description：
 * @ modified By：
 * @ version:
 */
@RestController
@RequestMapping("inventory/inspection")
public class InspectionInWarehouseApplicationController {
    @Autowired
    InspectionInWarehouseApplicationService inspectionInWarehouseApplicationService;
    /**
     * @param inspectionInWarehouseApplication
     * @return com.wn.common.ResponseEntity
     * @ author nst
     * @ date 2022/10/21 14:28
     * @ Description 需要提供申请人id,库存台账id,数量，流程id(测试，后续由流程模块获取)
     */
    @RequestMapping("add")
    public ResponseEntity add(@RequestBody @Validated InspectionInWarehouseApplication inspectionInWarehouseApplication, HttpServletRequest request){
        inspectionInWarehouseApplicationService.insert(inspectionInWarehouseApplication,request);
        return ResponseEntity.success;
    }

    @RequestMapping("addition")
    public ResponseEntity getByCondition(@RequestBody InspectionInWarehouseApplicationVo inspectionInWarehouseApplicationVo){
        PageBean<InspectionInWarehouseApplication> pageBean = inspectionInWarehouseApplicationService.getByCondition(inspectionInWarehouseApplicationVo);
        return new ResponseEntity(pageBean);
    }
}
